package main;

import javax.xml.bind.DatatypeConverter;
import java.security.MessageDigest;

public class PasswordHelper {
    public static String hashPassword(String password) {
        String result = null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(password.getBytes());
            byte[] digest = md.digest();
            result =  DatatypeConverter.printHexBinary(digest);
        }
        catch (Exception e) {
            Logman.error("Hash Password error: " + e.getStackTrace().toString());
        }

        return result;
    }
}
